package chapter1.socket.task;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Scanner;

/*
3：通过InetAddress获得远程服务器的所有ip，
 通过域名，比如sina.com,用程序获得其服务器的ip（要考虑有多个服务器的情况）
 */
public class Task3_Client {
    public static void main(String[] args) throws UnknownHostException {
        Scanner input = new Scanner(System.in);
        InetAddress inetAddress = null;
        while (true) {
            System.out.println("输入服务器的域名：");
            String s = input.next();
            if (s.equals("quit"))
                break;
            inetAddress = InetAddress.getByName(s);
            System.out.println(inetAddress);
        }

    }
}


